<script setup>
import {ref, watch} from "vue";
import axios from "axios";
import ReleaseContent from "@/components/Release/ReleaseContent.vue";
import GameContent from "@/components/SearchContent/GameContent.vue";

const props = defineProps({
  Search: String
})

const list = ref([])

watch(() => props.Search, async (text) => {
  list.value = (await axios.get("http://127.0.0.1:8081/goods/SearchGoods", {
    params: {
      key: text
    }
  })).data
  console.log(list.value)
}, {immediate: true})

</script>

<template>
  <div class = "border">
    <div v-for = "(list,index) in list" :key = "index">
      <GameContent class="GameContent" :img="list.Avatar" :name="list.name" :price="list.price / 100"/>
    </div>
  </div>
</template>

<style scoped>
.GameContent{
  margin: 20px 0;
}
</style>